

using System.Numerics;

namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_CrossProduct_RT : RT_Node
    {
        public RT_SingleValuePort VectorA_RT;

        public RT_SingleValuePort VectorB_RT;

        public RT_SingleValuePort Result_RT;

        public Node_CrossProduct_RT(Node_CrossProduct sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            VectorA_RT = new RT_SingleValuePort(EPortIOType.Input, sourceData.VectorA, this);

            VectorB_RT = new RT_SingleValuePort(EPortIOType.Input, sourceData.VectorB, this);

            Result_RT = new RT_SingleValuePort(EPortIOType.Output, sourceData.Result, this);
            Result_RT.OnGetValue = GetResult;
        }

        public AValue GetResult(DAG_Executor executor)
        {
            Vector3 vecA = VectorA_RT.GetValue(executor).ToVector3().Item2;
            Vector3 vecB = VectorB_RT.GetValue(executor).ToVector3().Item2;

            Vector3 result = Vector3.Cross(vecA, vecB);
            Result_RT.SourceValue.SetVector3(result);

            return Result_RT.SourceValue;
        }
    }
}